#ifndef SUPERPIXELSEGMENTATION_H
#define SUPERPIXELSEGMENTATION_H
#include "opencv2/opencv.hpp"
#include <QString>
#include <QObject>
class SuperpixelSegmentation : public QObject
{
    Q_OBJECT
public:
    SuperpixelSegmentation(QObject *parent = nullptr);
public:
    cv::Mat GetSegmentationImage(cv::Mat image);
private:
    cv::Mat segmentationImage;
    void init_clusters(const cv::Mat lab, int S);
    inline int get_distance(const cv::Mat lab, int clusters_index, int i, int j);
    void update_pixel(const cv::Mat lab, int s);
    void updaye_clusters(const cv::Mat lab);
    void draw_clusters(const cv::Mat copy);
    void final_draw(const cv::Mat lab, cv::Mat copy);
    void draw_edge(const cv::Mat lab, cv::Mat copy);
signals:
    void SignSegmentationString(QString str);
};

#endif // SUPERPIXELSEGMENTATION_H
